home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
CW GUSI 1.6.4
/
include
/
TFileGlob.h
< prev
next >
Wrap
Text File
|
1995-11-05
|
2KB
|
71 lines
/*********************************************************************
Project : GUSI - Grand Unified Socket Interface
File : TFileGlob.h - C and C++ routines for wildcard expansion
Author : Matthias Neeracher
Language : MPW C/C++
$Log: TFileSpec.h,v $
*********************************************************************/
#ifndef _TFILEGLOB_
#define _TFILEGLOB_
#include <TFileSpec.h>
#ifdef __cplusplus
/************************** The C++ only interface ***************************/
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
class TFileGlob : public TFileSpec {
public:
TFileGlob() {}
// Construct from TFileGlob
TFileGlob(const TFileGlob & glob);
// Construct from pattern relative to directory TFileSpec
TFileGlob(const char * pattern, const TFileSpec * startDir = nil);
Boolean Valid() { return valid; }
Boolean Next();
private:
struct BackTrack {
short index;
short vRefNum;
long parID;
char * pattern;
};
Boolean valid;
char segments;
char * patBuf;
BackTrack * track;
Boolean Next(BackTrack * track, int depth, Boolean init = false);
};
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
typedef TFileGlob * FileGlobRef;
extern "C" {
#else
typedef void * FileGlobRef;
#endif
/* Routines shared between C and C++ */
FileGlobRef NewFileGlob(const char * pattern);
Boolean NextFileGlob(FileGlobRef glob);
Boolean FileGlob2FSSpec(FileGlobRef glob, FSSpec * spec);
void DisposeFileGlob(FileGlobRef glob);
#ifdef __cplusplus
}
#endif
#endif